package com.cbs.database.test;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import com.cbs.database.Database;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class MyActivity extends Activity {
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Database db = MyApplication.database;


        db.delete("delete from test1");
        long t1 = System.currentTimeMillis();
//        for (int i = 0; i < 2000; i++) {
//            db.execute("insert into test1(name) values('abc')");
//        }
        List<String> sqls = new ArrayList<String>();
        for (int i = 0; i < 2000; i++) {
            sqls.add("insert into test1(name) values('abc')");
        }
        db.executeBatch(sqls);

        long t2 = System.currentTimeMillis();
        Log.e("test", String.valueOf(t2 - t1));
        List<Map<String, Object>> list = db.query("select * from test1");
        int a = list.size();
//        Log.e("test", db.scalar("select count(1) c from test1").toString());
    }
}
